package com.jbm.jsm.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;

/**
 * Created by lyh on 2017/10/27.
 */
@Entity
@Table(name = "trust_sm", schema = "", catalog = "jsm")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class TrustSmEntity extends IAcross
{
    private int tsmId;

    private Integer createId;
    private Timestamp createDate;
    private String reason;

    private Integer saId;

    private UserEntity userEntity;
    private SmallAccountEntity smallAccountEntity;
    private List<TrustSmEntity> trustSmEntityList;
    private UserEntity createUser;

    public TrustSmEntity()
    {
        super();
    }

    public TrustSmEntity(IAcross ia)
    {
        super(ia);
    }

    @Id
    @Column(name = "tsm_id")
    @GeneratedValue
    public int getTsmId() {
        return tsmId;
    }

    public void setTsmId(int tsmId) {
        this.tsmId = tsmId;
    }



    @Basic
    @Column(name = "create_id")
    public Integer getCreateId() {
        return createId;
    }

    public void setCreateId(Integer createId) {
        this.createId = createId;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "reason")
    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TrustSmEntity that = (TrustSmEntity) o;

        if (tsmId != that.tsmId) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (createId != null ? !createId.equals(that.createId) : that.createId != null) return false;
        if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
        if (saId != null ? !saId.equals(that.saId) : that.saId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = tsmId;
        result = 31 * result + (saId != null ? saId.hashCode() : 0);
        result = 31 * result + (createId != null ? createId.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (reason != null ? reason.hashCode() : 0);
        return result;
    }



    @Basic
    @Column(name = "sa_id")
    public Integer getSaId() {
        return saId;
    }

    public void setSaId(Integer saId) {
        this.saId = saId;
    }

    @Transient
    public SmallAccountEntity getSmallAccountEntity() {
        return smallAccountEntity;
    }

    public void setSmallAccountEntity(SmallAccountEntity smallAccountEntity) {
        this.smallAccountEntity = smallAccountEntity;
    }



    @Transient
    public UserEntity getUserEntity() {
        return userEntity;
    }

    public void setUserEntity(UserEntity userEntity) {
        this.userEntity = userEntity;
    }
    @Transient
    public List<TrustSmEntity> getTrustSmEntityList() {
        return trustSmEntityList;
    }

    public void setTrustSmEntityList(List<TrustSmEntity> trustSmEntityList) {
        this.trustSmEntityList = trustSmEntityList;
    }

    @Transient

    public UserEntity getCreateUser() {
        return createUser;
    }

    public void setCreateUser(UserEntity createUser) {
        this.createUser = createUser;
    }
}
